package com.redispro.controller;


import com.redispro.dto.Result;
import com.redispro.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 李力
 * @since 2022-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Autowired
    private IFollowService followService;

    //关注或者取关
    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable("id") Long isFollowId, @PathVariable("isFollow") Boolean isFollow) {
        return followService.follow(isFollowId, isFollow);
    }

    //判断关注还是没有关注
    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable("id") Long isFollowId) {
        return followService.isFollow(isFollowId);
    }

    @GetMapping("/common/{id}")
    public Result commonFollow(@PathVariable("id") Long targetId) {
        return followService.commonFollow(targetId);
    }
}
